/// @tags: LinerBase
#include <algorithm>
#include <cstdio>
#include <iostream>

using namespace std;

namespace BlueQuantum {

int const N = 5e2 + 5, K = 32;

int n, m;
int base[N], a[N][N];

inline void insert(int x) {
  for (int i = K - 1; i >= 0; --i) {
    if ((x >> i) & 1) {
      if (!base[i]) return base[i] = x, void();
      else
        x ^= base[i];
    }
  }
}

inline int query() {
  int res = 0;
  for (int i = 1; i <= n; ++i) res ^= a[i][1];
  for (int i = 2; i <= m; ++i) res ^= a[n][i];
  for (int i = K - 1; i >= 0; --i)
    if ((res ^ base[i]) > res) res ^= base[i];
  return res;
}

inline int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) cin >> a[i][j];
  for (int i = 1; i < n; ++i)
    for (int j = 1; j <= m; ++j) insert(a[i][j] ^ a[i + 1][j]);
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j < m; ++j) insert(a[i][j] ^ a[i][j + 1]);
  cout << query();
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("签到.in", "r", stdin);
  freopen("签到.out", "w", stdout);
#endif
#endif

  ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  return BlueQuantum::main();
}
